package com.kc.business.mapper;


import com.kc.business.domain.KcShareProfitConfig;
import com.kc.common.core.dao.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * FileName: KcShareProfitConfigMapper
 * Author:   TP
 * Date:     2020-11-03 17:42
 * Description: 分润配置Mapper
 */
public interface KcShareProfitConfigMapper extends BaseMapper<KcShareProfitConfig> {

    @Select("select * from kc_share_profit_config where is_deleted = 0 and (product_type_name = #{name} or product_type_key = #{key})")
    List<KcShareProfitConfig> getActiveConfigsByNameOrType(@Param("key") String productTypeKey,
                                                           @Param("name") String productTypeName);

    @Update("update kc_share_profit_config set is_deleted = 1, update_time = now(), update_by = #{username} where id = #{id}")
    int deleteById(@Param("id") Integer id,
                   @Param("username") String username);
}
